////////////////////////////////////////////////////////////////////////////////
//
//  MICROSOFT CORPORATION
//  Copyright (c) Microsoft Corporation.
//  All Rights Reserved.
//
//  NOTICE: Microsoft Confidential. Intended for Internal Use Only.
//
////////////////////////////////////////////////////////////////////////////////

package com.msn.beet.tracking.atlas
{

import com.msn.beet.errors.UnsupportedMethodException;
import com.msn.beet.tracking.ITrackModel;

/**
 * Class for common video tracking requirements. This class is likely to
 * change depending on the emerging tracking requirements for video.
 *
 * TODO: get details on video session requirements.
 *
 */
public class AtlasVideoAction extends AtlasTrackAction
{
    include "../../core/Version.as";

    // constants are ACTION, videoFileName is ACTION_NAME
    // following seven are heartbeat
    public static const VIDEO_START:String = "videostart";
    public static const VIDEO_WATCH:String = "videowatch";
    public static const VIDEO_PLAY:String = "videoplay";
    public static const VIDEO_PAUSE:String = "videopause";
    public static const VIDEO_STOP:String = "videostop";
    public static const VIDEO_SLIDER:String = "videoslider";
    public static const VIDEO_END:String = "videoend";
    //
    public static const VIDEO_SOUND_ON:String = "videosoundon";
    public static const VIDEO_SOUND_OFF:String = "videosoundoff";
    public static const VIDEO_FULL_SCREEN:String = "videofullscreen";
    public static const VIDEO_NORMAL_SCREEN:String = "videonormalscreen";
    public static const VIDEO_NEXT:String = "videonext";
    public static const VIDEO_PREVIOUS:String = "videoprevious";
    //
    public static const VIDEO_SESSION:int = 256;

    // click action
    public static const EMBED_VIDEO:String = "embedvideo";
    // click action
    public static const COPY_VIDEO_URL:String = "copyvideourl";

    protected var time:int;
    protected var length:int;
    protected var videoSession:int;

    public function AtlasVideoAction(videoUIAction:String, videoFileName:String,
                                     time:int, length:int)
    {
        super(videoFileName, videoUIAction);
        this.time = time;
        this.length = length;
        this.videoSession = videoSession;
    }

    /**
     * http://switch.atdmt.com/action/msn_riax_itm2/v3/language.en-us/count\
     * ry.US/location.hub/
     * action.videowatch/
     * actionname.itm2_BLOOPERS2_h_flv/
     * time.70/
     * videotime.216/
      * videosession.itm2_BLOOPERS2_h_flv289486/
     * resolution.1280x1024/?0.2631332963982689
     */
    /**
     * @param model
     * @return
     */
    override public function parseForAtlas(model:ITrackModel):String
    {
        var atlasModel:AtlasModel = AtlasModel(model);
        var track:String = atlasModel.baseString +
            join(super.action, "action") +
            join(super.id, "actionname") +
            join(String(this.time), "time") +
            join(String(this.length), "videotime") +
            join(atlasModel.location, "location") +
            join(atlasModel.section, "section") +
            "?" + Math.random();
        return track;
    }

    /**
    * Unsupported method.
    */
    override public function parseForAtlasJS(model:ITrackModel):String
    {
        var msg:String = "Video tracking not integrated with Atlas.js, " +
                         "use AtlasSender";
        throw new UnsupportedMethodException(msg);
    }

}

}
